package com.travel.controller;

import com.qianfeng.util.ResultMsg;
import com.travel.entity.TbCart;
import com.travel.entity.TbTripOrder;
import com.travel.entity.TbUser;
import com.travel.service.TripOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/tripOrder")
public class FontTripOrderController {
    @Autowired
    TripOrderService tripOrderService;
    /**
     * 添加车票订单
     * */
    @GetMapping("/addCartOrder")
    public ResultMsg addCartOrder(TbCart tbCart, TbUser tbUser){
        return tripOrderService.addCartOrder(tbCart,tbUser);
    }

    /**
     * 添加车票订单
     * */
    @PostMapping("/carOrder")
    public ResultMsg carOrder(@RequestBody TbTripOrder tbTripOrder){
        return tripOrderService.carOrder(tbTripOrder);
    }
    /**
     * 添加机票订单
     * */
    @PostMapping("/airOrder")
    public ResultMsg addAirOrder(@RequestBody TbTripOrder tbTripOrder){
        return tripOrderService.addAirOrder(tbTripOrder);
    }
    /**
     * 查询所有出行订单
     * */
    @GetMapping("/findAll")
    public ResultMsg findAllOrder( int current,  int size){
        return tripOrderService.findAllOrder(current,size);
    }
    /**
     * 删除订单
     * */
    @PostMapping("/tripOrder/del/{tripTicketId}")
    public ResultMsg deleteByOne(@PathVariable("tripTicketId") String tripTicketId){
        return tripOrderService.deleteByOne(tripTicketId);

    }
    /*@GetMapping("/addCartOrder")
    public ResultMsg addCartOrder(TbTripOrder tbTripOrder){
        return tripOrderService.addCartOrder(tbTripOrder);
    }*/

    /**
     * 购买汽车票
     */
    /*@GetMapping("/payCartById")
    public ResultMsg payCartById(){
        return cartService.payCartById();
    }*/
}
